package org.odst.transformation;

import java.util.ArrayList;
import java.util.List;

import org.odst.formula.CellRef;
import org.odst.tag.Block;
import org.odst.tag.Point;


/**
 * Remove transformation
 * @author Leonid Vysochyn
 * @author Cyril PODER
 */
public class RemoveTransformation extends BlockTransformation {

    public RemoveTransformation(Block block) {
        super(block);
    }

    public Block getBlockAfterTransformation() {
        return null;  
    }


    public List<Point> transformCell(Point p) {
        List<Point> cells = null;
        if( !block.contains( p ) ){
            cells = new ArrayList<Point>();
            cells.add(p);
        }
        return cells;
    }

    public List<String> transformCell(String sheetName, CellRef cellRef) {
        List<String> cells = null;
        String refSheetName = cellRef.getSheetName();
        if( block.getSheet().getSheetName().equalsIgnoreCase( refSheetName ) || (cellRef.getSheetName() == null && block.getSheet().getSheetName().equalsIgnoreCase( sheetName ))){
            if( !block.contains( cellRef.getRowNum(), cellRef.getColNum() ) ){
                cells = new ArrayList<String>();
                cells.add( cellRef.toString() );
            }
        }else{
            cells = new ArrayList<String>();
            cells.add( cellRef.toString() );
        }
        return cells;
    }

    public String toString() {
        return "RemoveTransformation: {" + super.toString() + "}";
    }
}
